package com.sc.nft.controller;

import com.sc.nft.controller.request.IdRequest;
import com.sc.nft.entity.vo.DaoSchoolArticleMaterialTopIdVO;
import com.sc.nft.service.DaoSchoolChildService;
import com.sc.nft.sup.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * dao学堂子分类表(DaoSchoolChild)表控制层
 *
 * @author makejava
 * @since 2023-03-13 16:21:56
 */

@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("daoSchoolChild")
@Api(tags = "子分类")
public class DaoSchoolChildController {

    /**
     * 服务对象
     */
    private final DaoSchoolChildService daoSchoolChildService;

    @ApiOperation(value = "根据父集id获取子集数据列表", notes = "根据父集id获取子集数据列表", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/selectByTopId", produces = MediaType.APPLICATION_JSON_VALUE)
    public Result<List<DaoSchoolArticleMaterialTopIdVO>> selectByTopId(@RequestBody IdRequest idRequest) {
        List<DaoSchoolArticleMaterialTopIdVO> data = daoSchoolChildService.selectByTopId(idRequest.getId());
        return Result.success(data);
    }

}
